class CommissionPolicy {
    String name
    Product product
    ProductCategory productCategory
    static belongsTo = CommissionPolicyGroup

    static constraints = {

        product(nullable: true,
                validator: {val, CommissionPolicy obj ->
                    !(
                        (!obj.product && !obj.productCategory)
                            ||
                        (obj.product && obj.productCategory)
                    )
                })
        productCategory(nullable: true)
    }

    String toString() {
        return name
    }

}
